import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "rabbitmqmodel"
import "models"

Item {
    id: root
    Text {
        id: page1
        text: qsTr("页面4")
        anchors.horizontalCenter: root.horizontalCenter
        anchors.top: root.top
    }
    function build_getlog_request() {
        var req = {
            "condition": "timestamp>=1641626578 and timestamp<=1649398977 ORDER BY timestamp DESC",
            "name": "storage.get",
            "resource": "alarm.data",
            "offset": 0,
            "limit": 20
        }
        return JSON.stringify(req)
    }
    Button {
        text: "获取log"
        onClicked: {
            var req = build_getlog_request()
            RabbitmqManager.publish(Utils._SERVICE_NAME_STORAGE, req,
                                    function (msg) {
                                        console.log("get log:", msg)
                                    })
        }
    }
}
